package cevent.source.cloudcenter.server.config;/**
 * Created by Cevent on 2021/3/14.
 */

import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/** 单一springboot项目使用该类完成关于配置
 * @author cevent
 * @description 跨域问题CORS-cross origin resource sharing跨原始站点资源共享问题，即跨域问题
 * @date 2021/3/14 17:24
 */
/*
@Configuration
public class CorsConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        //请求路径限制
        registry.addMapping("/**")
                .allowedOriginPatterns("*")
                .allowedHeaders(CorsConfiguration.ALL)
                .allowedMethods(CorsConfiguration.ALL)
                .allowCredentials(true)
                .maxAge(3600);//1小时无需再次检测（发送OPTIONS请求）
    }
}
*/
